<?php
/*
 * #评价控制器
 * #评论控制器
 */ 
class Ajax extends CI_Controller{
	function Ajax(){
		parent::__construct();
	}
	
/*	function test(){
		$rank=5;
		$fid = 8;
		
		$this->load->model('share/File');
		$final_rank = $this->File->add_rank($fid,$rank);
		
		
		if($flag){
			$final_rank = $this->db->query("SELECT rank FROM dy_upload WHERE fid = '$fid'");
			$final_rank = $final_rank->result_array();
			$final_rank = $final_rank[0]['rank'];
			echo $final_rank;
		}else
			echo "add_rank failed!";
	}
*/	
	function addrank(){
		
		$rank = $_POST['rank'];
		$fid = $_POST['fid'];
		
		$this->load->model('share/File');
		$flag = $this->File->add_rank($fid,$rank);
				
		$this->File->final_rank($flag,$fid);
	}
	
	function addcomment()
	{
		$comment = $_POST['comment'];
		$fid = $_POST['fid'];
		$this->load->model('user/user_model');
		$this->load->model('share/comment');
		$uid = $this->user_model->get_uid();
		$this->comment->add($fid,$uid,$comment);
		echo $comment;	
	}	
}
?>